/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Usuario.java
 *
 * Created on 26-may-2009, 19:23:29
 */

package uig;

import javax.swing.JOptionPane;

/**
 *
 * @author luisexposito
 */
public class Usuario extends javax.swing.JFrame {

    /** Creates new form Usuario */
    public Usuario() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        venta = new javax.swing.JRadioButton();
        compra = new javax.swing.JRadioButton();
        dato = new javax.swing.JRadioButton();
        acciones = new javax.swing.JRadioButton();
        NASDAQ = new javax.swing.JRadioButton();
        aceptar = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setTitle("Menu usuario");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        venta.setText("Ventas");
        venta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ventaActionPerformed(evt);
            }
        });

        compra.setText("Compras");
        compra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                compraActionPerformed(evt);
            }
        });

        dato.setText("Cargar datos financieros");
        dato.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                datoActionPerformed(evt);
            }
        });

        acciones.setText("Mis accciones");
        acciones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                accionesActionPerformed(evt);
            }
        });

        NASDAQ.setText("Acciones de NASDAQ");
        NASDAQ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                NASDAQActionPerformed(evt);
            }
        });

        aceptar.setText("ACEPTAR");
        aceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aceptarActionPerformed(evt);
            }
        });

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/casa.jpg"))); // NOI18N

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(29, 29, 29)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(venta)
                    .add(compra)
                    .add(acciones))
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 39, Short.MAX_VALUE)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(dato)
                            .add(NASDAQ)))
                    .add(layout.createSequentialGroup()
                        .add(74, 74, 74)
                        .add(aceptar)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(33, 33, 33))
            .add(layout.createSequentialGroup()
                .add(91, 91, 91)
                .add(jLabel1)
                .addContainerGap(100, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(28, 28, 28)
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 29, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(acciones)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(compra)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(venta))
                    .add(layout.createSequentialGroup()
                        .add(dato)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(NASDAQ)
                        .add(18, 18, 18)
                        .add(aceptar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 38, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void ventaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ventaActionPerformed
        // TODO add your handling code here:
        if (venta.isSelected() != false) {
            acciones.setEnabled(false);
            compra.setEnabled(false);
            NASDAQ.setEnabled(false);
            dato.setEnabled(false);
        }//
        else {
            acciones.setEnabled(true);
            compra.setEnabled(true);
            NASDAQ.setEnabled(true);
            dato.setEnabled(true);
        }
}//GEN-LAST:event_ventaActionPerformed

    private void compraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_compraActionPerformed
        // TODO add your handling code here:
        if (compra.isSelected() != false) {
            venta.setEnabled(false);
            acciones.setEnabled(false);
            NASDAQ.setEnabled(false);
            dato.setEnabled(false);
        }//
        else {
            venta.setEnabled(true);
            acciones.setEnabled(true);
            NASDAQ.setEnabled(true);
            dato.setEnabled(true);
        }
}//GEN-LAST:event_compraActionPerformed

    private void datoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_datoActionPerformed
        // TODO add your handling code here:
        if (dato.isSelected() != false) {
            venta.setEnabled(false);
            compra.setEnabled(false);
            NASDAQ.setEnabled(false);
            acciones.setEnabled(false);
        } else {
            venta.setEnabled(true);
            compra.setEnabled(true);
            NASDAQ.setEnabled(true);
            acciones.setEnabled(true);
        }
}//GEN-LAST:event_datoActionPerformed

    private void accionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_accionesActionPerformed
        if (acciones.isSelected() != false) {
            venta.setEnabled(false);
            compra.setEnabled(false);
            NASDAQ.setEnabled(false);
            dato.setEnabled(false);
        } else {
            venta.setEnabled(true);
            compra.setEnabled(true);
            NASDAQ.setEnabled(true);
            dato.setEnabled(true);
        }
}//GEN-LAST:event_accionesActionPerformed

        private void NASDAQActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NASDAQActionPerformed
            //
            if (NASDAQ.isSelected() != false) {
                venta.setEnabled(false);
                compra.setEnabled(false);
                acciones.setEnabled(false);
                dato.setEnabled(false);
            } else {
                venta.setEnabled(true);
                compra.setEnabled(true);
                acciones.setEnabled(true);
                dato.setEnabled(true);
            }
        }//GEN-LAST:event_NASDAQActionPerformed

        private void aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aceptarActionPerformed
            // TODO add your handling code here:
            if (dato.isSelected() != false) {
                cargaDato cargar = new cargaDato();
                cargar.setVisible(true);
            }
            if (acciones.isSelected()!= false) {
                Accion accion = new Accion();
                accion.setVisible(true);
            }
            /*int val = JOptionPane.YES_OPTION;
            if (val == 1)
            this.setVisible(false);
            else
            System.out.println("hola");*/
}//GEN-LAST:event_aceptarActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Usuario().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton NASDAQ;
    private javax.swing.JRadioButton acciones;
    private javax.swing.JButton aceptar;
    private javax.swing.JRadioButton compra;
    private javax.swing.JRadioButton dato;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JRadioButton venta;
    // End of variables declaration//GEN-END:variables

}
